<!DOCTYPE html>
<body>
<template id="target-template">
<svg width="90" height="90">
<path class="target" />
</svg>
</template>
<script src="../svg-attribute-interpolation/resources/interpolation-test.js"></script>
<script>
'use strict';

// SVG Paths always replace.

assertAttributeInterpolation({
  property: 'd',
  underlying: 'M 10 10 H 20',
  from: 'M 20 30 L 40 50',
  fromComposite: 'add',
  to: 'M 30 40 L 50 60',
  toComposite: 'add',
}, [
  {at: -0.4, is: 'M 16 26 L 36 46'},
  {at: 0, is: 'M 20 30 L 40 50'},
  {at: 0.2, is: 'M 22 32 L 42 52'},
  {at: 0.6, is: 'M 26 36 L 46 56'},
  {at: 1, is: 'M 30 40 L 50 60'},
  {at: 1.4, is: 'M 34 44 L 54 64'},
]);

assertAttributeInterpolation({
  property: 'd',
  underlying: 'M 10 10 H 20',
  from: 'M 20 30 L 40 50',
  fromComposite: 'add',
  to: 'M 30 40 H 50',
  toComposite: 'add',
}, [
  {at: -0.4, is: 'M 20 30 L 40 50'},
  {at: 0, is: 'M 20 30 L 40 50'},
  {at: 0.2, is: 'M 20 30 L 40 50'},
  {at: 0.6, is: 'M 30 40 H 50'},
  {at: 1, is: 'M 30 40 H 50'},
  {at: 1.4, is: 'M 30 40 H 50'},
]);

assertAttributeInterpolation({
  property: 'd',
  underlying: 'M 10 10 H 20',
  from: 'm 20 30 L 40 50',
  fromComposite: 'add',
  to: 'm 30 40 L 50 60',
  toComposite: 'replace',
}, [
  {at: -0.4, is: 'm 16 26 L 36 46'},
  {at: 0, is: 'm 20 30 L 40 50'},
  {at: 0.2, is: 'm 22 32 L 42 52'},
  {at: 0.6, is: 'm 26 36 L 46 56'},
  {at: 1, is: 'm 30 40 L 50 60'},
  {at: 1.4, is: 'm 34 44 L 54 64'},
]);

assertAttributeInterpolation({
  property: 'd',
  underlying: 'M 10 10 L 20 20',
  from: neutralKeyframe,
  to: 'm 30 40 l 50 60',
  toComposite: 'replace',
}, [
  {at: -0.4, is: 'm 2 -2 l -6 -10'},
  {at: 0, is: 'M 10 10 L 20 20'},
  {at: 0.2, is: 'm 14 16 l 18 20'},
  {at: 0.6, is: 'm 22 28 l 34 40'},
  {at: 1, is: 'm 30 40 l 50 60'},
  {at: 1.4, is: 'm 38 52 l 66 80'},
]);

assertAttributeInterpolation({
  property: 'd',
  underlying: 'M 10 10 L 20 20',
  from: neutralKeyframe,
  to: 'm 30 40 l 50 60',
  toComposite: 'add',
}, [
  {at: -0.4, is: 'm 2 -2 l -6 -10'},
  {at: 0, is: 'M 10 10 L 20 20'},
  {at: 0.2, is: 'm 14 16 l 18 20'},
  {at: 0.6, is: 'm 22 28 l 34 40'},
  {at: 1, is: 'm 30 40 l 50 60'},
  {at: 1.4, is: 'm 38 52 l 66 80'},
]);

assertAttributeInterpolation({
  property: 'd',
  underlying: 'm 30 40 l 50 60',
  from: 'M 10 10 L 20 20',
  fromComposite: 'add',
  to: neutralKeyframe,
}, [
  {at: -0.4, is: 'm 2 -2 l -6 -10'},
  {at: 0, is: 'M 10 10 L 20 20'},
  {at: 0.2, is: 'm 14 16 l 18 20'},
  {at: 0.6, is: 'm 22 28 l 34 40'},
  {at: 1, is: 'm 30 40 l 50 60'},
  {at: 1.4, is: 'm 38 52 l 66 80'},
]);
</script>
</body>
</html>
